import {baseUrl} from "@/utils/global.js"
export function uploadFile(path) {
	return new Promise((resolve, reject) => {
		uni.uploadFile({
			url: baseUrl+'/localUpload-file/upload',
			filePath: path,
			name: 'file',
			header: { //（根据自身接口要求选择）
				'Authorization': 'Basic bWluaTptaW5pX3NlY3JldA==',
				"Blade-Auth":"bearer "+ uni.getStorageSync('accessToken')
			},
			success: res => {
				const imgRes = JSON.parse(res.data)
				if (imgRes.code == 200) {
					resolve(imgRes.data)
				} else {
					uni.showToast({
						icon:'none',
						title:'上传失败'
					})
				}
			},
			fail: () => {
				reject('网络错误');
			}
		});
	})
}